
 <template>
 	<el-dialog title="" width="60%" visible :show-close="false" :append-to-body="true" class="wrap" >
 		<i class="el-icon-close close" @click="cancel" style="color: white;z-index: 99;"></i>
		 <div class="bt">{{form.jsmc}}的修改</div>
 		<el-form label-width="100px" class="form">
 			<el-form-item label="上课时段">
				  <el-select v-model="form.sjqj" placeholder="请选择时段" class="select-block">
                    <el-option label="上午" value="上午"></el-option>
                    <el-option label="下午" value="下午"></el-option>
                    <el-option label="夜晚" value="夜晚"></el-option>
                </el-select>
			</el-form-item>
 			<!--<el-form-item label="">
				  <el-time-picker  style="height:40px;" is-range v-model="form.timeduan" placeholder="选择时间范围" class="select-block"> </el-time-picker>
			</el-form-item>-->
			<el-form-item label="上课时间" >
		     <div class="left" style="width:230px;float: left;">
		     	<div style="float: left; " ></div>
			 <div class="search-item" style="width: 80px;float: left;">
                <el-select v-model="btimeh" style="float: left;">
            				<el-option label="06"	value="06"></el-option>
            				<el-option label="07"	value="07"></el-option>
            				<el-option label="08"	value="08"></el-option>
            				<el-option label="09"	value="09"></el-option>
            				<el-option label="10"	value="10"></el-option>
            				<el-option label="11"	value="11"></el-option>
            				<el-option label="12"	value="12"></el-option>
            				<el-option label="13"	value="13"></el-option>
            				<el-option label="14"	value="14"></el-option>
            				<el-option label="15"	value="15"></el-option>
            				<el-option label="16"	value="16"></el-option>
            				<el-option label="17"	value="17"></el-option>
            				<el-option label="18"	value="18"></el-option>
            				<el-option label="19"	value="19"></el-option>
            				<el-option label="20"	value="20"></el-option>
            				<el-option label="21"	value="21"></el-option>
            				<el-option label="22"	value="22"></el-option>
                </el-select>
            </div>
            <div style="float: left; " >&nbsp;&nbsp;:&nbsp;&nbsp;</div>
            <div class="search-item" style="width: 80px;float: left;">
                <el-select v-model="etimem">
          				<el-option label="00"	value="00"></el-option>
          				<el-option label="05"	value="05"></el-option>
          				<el-option label="10"	value="10"></el-option>
          				<el-option label="15"	value="15"></el-option>
          				<el-option label="20"	value="20"></el-option>
          				<el-option label="25"	value="25"></el-option>
          				<el-option label="30"	value="30"></el-option>
          				<el-option label="35"	value="35"></el-option>
          				<el-option label="40"	value="40"></el-option>
          				<el-option label="45"	value="45"></el-option>
          				<el-option label="50"	value="50"></el-option>
          				<el-option label="55"	value="55"></el-option>
                </el-select>
            </div>
            <div class="a" style="float: right;margin-right: 20px;">--</div>
            </div>


		    <div class="left" style="width:230px;float: left;">
		     	<div style="float: left; " ></div>
			 <div class="search-item" style="width: 80px;float: left;">
                <el-select v-model="btimeh2" style="float: left;">
				<el-option label="06"	value="06"></el-option>
				<el-option label="07"	value="07"></el-option>
				<el-option label="08"	value="08"></el-option>
				<el-option label="09"	value="09"></el-option>
				<el-option label="10"	value="10"></el-option>
				<el-option label="11"	value="11"></el-option>
				<el-option label="12"	value="12"></el-option>
				<el-option label="13"	value="13"></el-option>
				<el-option label="14"	value="14"></el-option>
				<el-option label="15"	value="15"></el-option>
				<el-option label="16"	value="16"></el-option>
				<el-option label="17"	value="17"></el-option>
				<el-option label="18"	value="18"></el-option>
				<el-option label="19"	value="19"></el-option>
				<el-option label="20"	value="20"></el-option>
				<el-option label="21"	value="21"></el-option>
				<el-option label="22"	value="22"></el-option>
                </el-select>
            </div>
            <div style="float: left;">&nbsp;&nbsp; :&nbsp;&nbsp; </div>
            <div class="search-item" style="width: 80px;float: left;">
                <el-select v-model="etimem2">
				<el-option label="00"	value="00"></el-option>
				<el-option label="05"	value="05"></el-option>
				<el-option label="10"	value="10"></el-option>
				<el-option label="15"	value="15"></el-option>
				<el-option label="20"	value="20"></el-option>
				<el-option label="25"	value="25"></el-option>
				<el-option label="30"	value="30"></el-option>
				<el-option label="35"	value="35"></el-option>
				<el-option label="40"	value="40"></el-option>
				<el-option label="45"	value="45"></el-option>
				<el-option label="50"	value="50"></el-option>
				<el-option label="55"	value="55"></el-option>
                </el-select>
            </div>
            </div>
			</el-form-item>
      <el-form-item label="启用状态">
 				<!-- <el-input v-model="form.isenable" type="textarea" :rows="1" placeholder="请输入" class="select-block"></el-input> -->
        <el-tooltip :content="'Switch value: ' +form.isenable" placement="top">
          <el-switch v-model="form.isenable" active-color="#13ce66" inactive-color="#ff4949" inactive-text="禁用" active-text="启用" active-value="Y" inactive-value="N"></el-switch>
        </el-tooltip>
 			</el-form-item>
 			<el-form-item label="说明">
 				<el-input v-model="form.notes" type="textarea" :rows="2" placeholder="请输入" class="select-block"></el-input>
 			</el-form-item>



 		</el-form>
    <el-button type="danger" class="submit" @click="cancel">退出</el-button>
 		<el-button type="primary" class="submit" @click="submit">修改</el-button>
 	</el-dialog>
 </template>
 <script type="text/javascript">
 	import qs from 'qs'
 	export default {
 		props: ['params'],
 		data() {
 			return {

        btimeh:'',
        btimeh2:'',
        etimem:'',
        etimem2:'',
 				form: {
 					jsmc:'',
			           sjd :'',
			           timeduan:'',
			//         btimem:'',
			//         etimeh:'',
			           sjqj:'',
			           notes :'',
			           xh :'',
			           isenable :'',
 					 id:''
 				}
 			}
 		},
 		created() {
  		  this.form = this.params.row;
          this.loadinfo();
//
 		},
 		methods: {
 			loadinfo(){
				var logininfo = JSON.parse(localStorage.logininfo);
				             var params2 = qs.stringify({
				                  xxid:logininfo.xxid,
 							 yhid:logininfo.id,
 							 id:this.form.id
				               })
				             //执行
				                 this.axios.post(this.$store.state.api + 'jssjd/info',  params2 )
				                 .then(res => {
				                        this.btimeh =this.form.sjd.substring(0,2);
					                    this.etimem =this.form.sjd.substring(3,5);
					                    this.btimeh2 =this.form.sjd.substring(7,9);
					                    this.etimem2 =this.form.sjd.substring(10,12);
				                 }).catch(res => {
									 this.$message.warning("服务器异常");
 			 				this.$emit('close', { type: 'info', cancel: true });
								})
 			},
 			 submit() {
 			 		var arr = this.btimeh+":"+this.etimem
 			 		var arr2 = this.btimeh2+":"+this.etimem2
 			 		var arr3 = arr+"--"+arr2

 				//检测
 			// 	this.$store.state.loading = true;
 				/*if(!this.form.id) {
 					this.$message.warning('请填写分类');
 					this.$store.state.loading = false;
 					return;
 				}*/
 				//装载数据
 				var logininfo = JSON.parse(localStorage.logininfo);
 				var params2 = qs.stringify({
 						id: this.form.id,
 						sjqj:this.form.sjqj,
 						sjd: arr3,
 						notes: this.form.notes,
 						xh: this.form.xh,
 						isenable: this.form.isenable,
 						yhid: logininfo.id,
 						xxid: logininfo.xxid
 					})
 				//执行
 				    this.axios.post(this.$store.state.api + 'jssjd/update',  params2 )
 						.then(res => {
 							if(res.data.code == 1) {
 								this.$emit('close', { type: 'edit', cancel: false });
 								this.$store.state.loading = false;
 							} else {
 							   this.$message.warning(res.data.msg);
 								this.$store.state.loading = false;
 							}
 						}).catch(res => {
 							this.$message.warning("服务器异常");
 							this.$store.state.loading = false;
 						})
 			},
 			cancel() {
 				this.$emit('close', { type: 'edit', cancel: true })
 			}
 		}
 	}
 </script>
 <style lang="less" scoped>
 	.wrap {
 		text-align: center;
 	}
 	.bt{
			position: absolute;
			width: 100%;
			height: 50px;
			margin: 0 auto;
			top:0;
			left:0;
			background: #50BFFF;
			margin-bottom: 20px;
			color:white;
			text-align:left;
			line-height: 50px;
			font-size: 17px;
			padding-left: 15px;
		}
 	.form {
 		text-align: left;
 		margin-top: 20px;
 	}
 	.input {
             display: inline-block;
         }
 	.select-block {
 		display: block;
    width: 85%;
 	}
 	.submit {
 		width: 120px;
 	}
 </style>
